package org.telluriumsource.ui.widget.dojo


import org.telluriumsource.ui.builder.UiObjectBuilderRegistry 
import org.telluriumsource.ui.widget.WidgetBootstrap 
import org.telluriumsource.ui.widget.dojo.builder.AutoCompleteTextBoxBuilder 
import org.telluriumsource.ui.widget.dojo.builder.ButtonBuilder 
import org.telluriumsource.ui.widget.dojo.builder.CheckBoxBuilder 
import org.telluriumsource.ui.widget.dojo.builder.ComboBoxBuilder 
import org.telluriumsource.ui.widget.dojo.builder.RadioButtonBuilder 
import org.telluriumsource.ui.widget.dojo.builder.TextBoxBuilder 
import org.telluriumsource.ui.widget.dojo.builder.TooltipDialogTextBoxBuilder 


/**
 * The bootstrap class for the Dojo widget module
 * 
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Sep 2, 2008
 * 
 */
class Init implements WidgetBootstrap {

    public void loadWidget(UiObjectBuilderRegistry uiObjectBuilderRegistry) {
        if (uiObjectBuilderRegistry != null) {
            uiObjectBuilderRegistry.registerBuilder(getFullName("TextBox"), new TextBoxBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("Button"), new ButtonBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("CheckBox"), new CheckBoxBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("RadioButton"), new RadioButtonBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("ComboBox"), new ComboBoxBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("TooltipDialogTextBox"), new TooltipDialogTextBoxBuilder());
            uiObjectBuilderRegistry.registerBuilder(getFullName("AutoCompleteTextBox"), new AutoCompleteTextBoxBuilder());
        }
    }

    protected String getFullName(String name){
        return DojoWidget.NAMESPACE + DojoWidget.NAMESPACE_SUFFIX + name;
    }
}